#include "StdAfx.h"
#include "Drawer.h"
#include "DeviceContext.h"
#include "PointGeometry.h"

CDrawer::CDrawer(void)
{
}

CDrawer::~CDrawer(void)
{
}

void CDrawer::drawMapLayer(CMapLayer* pLayer)
{
    m_pMap2ClientTrans->setSourceCRS(pLayer->getLayerCRS());
    CMapLayerDrawProperties properties = pLayer->getDrawProperties();
    m_pDC->setDrawProperties(properties);
    pLayer->draw(this);
    m_pDC->restore();
}


void CDrawer::drawPoint(double x, double y)
{
	m_pMap2ClientTrans->transform2Client(x,y);
	m_pDC->ellipse(x-5,y-5,x+5,y+5);
}

void CDrawer::drawLine(CPointGeometry* startPoint, CPointGeometry* endPoint)
{
	double x1,y1,x2,y2;
	x1 = startPoint->m_x;
	y1 = startPoint->m_y;
	x2 = endPoint->m_x;
	y2 = endPoint->m_y;
	m_pMap2ClientTrans->transform2Client(x1,y1);
	m_pMap2ClientTrans->transform2Client(x2,y2);
	m_pDC->line(x1,y1,x2,y2);
}

void CDrawer::drawLine(double x1, double y1, double x2, double y2)
{
	m_pMap2ClientTrans->transform2Client(x1,y1);
	m_pMap2ClientTrans->transform2Client(x2,y2);
	m_pDC->line(x1,y1,x2,y2);
}
